From: Eric S. Raymond Date: Sun, 25 Apr 1993 06:14:13 +0000 (+0000) Subject: (down-arrow): New function. Uses next-line-add-newlines to suppress X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~96483 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=3ab1f5b5ef5f7bd4753cec1c511c7dadde4a7b82;p=emacs.git (down-arrow): New function. Uses next-line-add-newlines to suppress addition of new lines at end of buffer. (up-arrow): Alias of previous-line, added for consistency. These changes complete terminal-type-independent support for arrow keys. --- diff --git a/lisp/simple.el b/lisp/simple.el index 1662127fe57..3731fbebb13 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1387,6 +1387,11 @@ The goal column is stored in the variable `goal-column'." goal-column)) nil) +;;; Make arrow keys do the right thing for improved terminal support +;;; When we implement true horizontal autoscrolling, right-arrow and +;;; left-arrow can lose the (if truncate-lines ...) clause and become +;;; aliases. + (defun right-arrow (arg) "Move right one character on the screen (with prefix ARG, that many chars). Scroll right if needed to keep point horizontally onscreen." @@ -1404,6 +1409,15 @@ Scroll left if needed to keep point horizontally onscreen." (if truncate-lines (let ((x (current-column)) (w (- (window-width) 2))) (set-window-hscroll (selected-window) (- x (% x w)) )))) + +(defun down-arrow (arg) + "Move down one line on the screen (with prefix ARG, that many lines). +If doing so would add lines to the end of the buffer, raise an error." + (interactive "P") + (let ((next-line-add-newlines nil)) + (next-line 1))) + +(defalias 'up-arrow 'previous-line) (defun transpose-chars (arg) "Interchange characters around point, moving forward one character.